home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / DocAssembler 1.0 folder.sit / DocAssembler 1.0 folder / DocAssembler 1.0 / DB+DA sample script < prev    next >
Text File  |  1996-02-17  |  6KB  |  137 lines

  1. (*
  2.  
  3. Sample script to show the DocBreaker-DocAssembler team scripting features
  4. Before using this sample script, you need:
  5.  
  6. - AppleScript software installed
  7. - XTND software installed
  8. - the DocBreaker application installed
  9. - the DocAssembler application installed in the same folder as DocBreaker
  10. - the "Examples" folder from the DocBreaker package in the same folder as DocBreaker
  11.  
  12. This example shows a RTF -> MacWrite Pro -> RTF translation.
  13. If the required translators are not available, you will have to change the script.
  14.  
  15. *)
  16.  
  17. with timeout of 600 seconds
  18.     try
  19.         tell application "DocBreaker 1.0"
  20.             activate
  21.             
  22.             -- assign the preferences
  23.             
  24.             set preference max files to 5
  25.             
  26.             set preference font rule to is_equal_to
  27.             set preference font to "Courier"
  28.             
  29.             set preference size rule to is_greater_than
  30.             set preference size to 14
  31.             
  32.             set preference style rule to is_equal_to
  33.             set preference style to plain -- this is needed to override existing preferences
  34.             set preference style to underline
  35.             set preference style to bold
  36.             
  37.             set preference justification rule to differs_from
  38.             set preference justification to right
  39.             
  40.             set preference color rule to is_equal_to
  41.             set preference color to red
  42.             
  43.             -- breaks the file "FileToBreak.rtf" and produces a file series called "Part.xxx"
  44.             -- asking to the MacWrite Pro 1.x translator to build MacWrite Pro files
  45.             
  46.             break the file ":Examples:FileToBreak.rtf" into file ":Examples:Part" using translator "MacWrite Pro 1.x" with format "MWPd"
  47.             quit
  48.         end tell
  49.         
  50.         tell application "DocAssembler 1.0"
  51.             activate
  52.             set theDoc to (make new document)
  53.             
  54.             -- append some files along with their hierarchical level
  55.             -- Level 0 is the top (section) level
  56.             -- Level -1  is the second (sub-section) level
  57.             -- Level -2 is the third (chapter) level
  58.             -- Level -3 is the bottom (paragraph) level
  59.             
  60.             tell theDoc to add the file ":Examples:part.001" with level 0
  61.             tell theDoc to add the file ":Examples:part.002" with level -1
  62.             tell theDoc to add the file ":Examples:part.003" with level -1
  63.             tell theDoc to add the file ":Examples:part.004" with level -2
  64.             tell theDoc to add the file ":Examples:part.005" with level -3
  65.             
  66.             -- assign the general preferences
  67.             
  68.             tell theDoc to set preference units to inches
  69.             tell theDoc to set preference left margin to 1.5
  70.             tell theDoc to set preference right margin to 1.5
  71.             tell theDoc to set preference top margin to 2.0
  72.             tell theDoc to set preference bottom margin to 2.0
  73.             tell theDoc to set preference with double sided
  74.             tell theDoc to set preference with include indexes
  75.             tell theDoc to set preference starting page to 3
  76.             
  77.             -- assign the left header preferences
  78.             
  79.             tell theDoc to set output option left header with include
  80.             tell theDoc to set output option left header font to "Courier"
  81.             tell theDoc to set output option left header size to 14
  82.             tell theDoc to set output option left header style to plain -- this is needed to override preferences file
  83.             tell theDoc to set output option left header style to underline
  84.             tell theDoc to set output option left header justification to center
  85.             tell theDoc to set output option left header color to blue
  86.             tell theDoc to set output option left header text to "This is a Courier 14, underlined, centered, blue left header"
  87.             
  88.             -- assign the right header preferences
  89.             
  90.             tell theDoc to set output option right header with include
  91.             tell theDoc to set output option right header font to "Geneva"
  92.             tell theDoc to set output option right header size to 12
  93.             tell theDoc to set output option right header style to plain -- this is needed to override preferences file
  94.             tell theDoc to set output option right header style to bold
  95.             tell theDoc to set output option right header justification to right
  96.             tell theDoc to set output option right header color to red
  97.             tell theDoc to set output option right header text to "This is a Geneva 12, bolded, right justified, red right header"
  98.             
  99.             -- assign the left footer preferences
  100.             
  101.             tell theDoc to set output option left footer with include
  102.             tell theDoc to set output option left footer font to "Helvetica"
  103.             tell theDoc to set output option left footer size to 12
  104.             tell theDoc to set output option left footer style to plain -- this is needed to override preferences file
  105.             tell theDoc to set output option left footer style to italic
  106.             tell theDoc to set output option left footer justification to left
  107.             tell theDoc to set output option left footer color to green
  108.             tell theDoc to set output option left footer text to "This is a Helvetica 12, italicized, left justified, green left footer"
  109.             
  110.             -- assign the right footer preferences
  111.             
  112.             tell theDoc to set output option right footer with include
  113.             tell theDoc to set output option right footer font to "Monaco"
  114.             tell theDoc to set output option right footer size to 12
  115.             tell theDoc to set output option right footer style to plain -- this is needed to override preferences file
  116.             tell theDoc to set output option right footer style to outline
  117.             tell theDoc to set output option right footer justification to full
  118.             tell theDoc to set output option right footer color to cyan
  119.             tell theDoc to set output option right footer text to "This is a Monaco 12, outlined, full justified, cyan right footer"
  120.             
  121.             -- produce an output file called "SumOfTheParts.rtf" asking to the RTF translator to build the file
  122.             
  123.             tell theDoc to produce the file ":Examples:SumOfTheParts.rtf" using translator "RTF" with format "TEXT"
  124.             
  125.             -- save the DocAssembler document under the name "BuiltFromScript"
  126.             
  127.             save theDoc in file ":Examples:SumOfTheParts"
  128.             quit
  129.         end tell
  130.     on error errText number errNum
  131.         beep
  132.         display dialog "An error occurred! " & errText & " Error code: " & errNum buttons {"Alas"} default button "Alas" with icon 0
  133.         tell application "DocBreaker 1.0" to quit
  134.         tell application "DocAssembler 1.0" to close theDoc saving no
  135.         tell application "DocAssembler 1.0" to quit
  136.     end try
  137. end timeout